import { Component } from '@angular/core';
// import { TestChildComponent} from './test-child.component';

@Component({
    selector: 'app-test',
    template: `
      <h1>hhhhhh</h1>
      <h2>{{title}}</h2>
      <h2>{{myHero}}</h2>
      <input type="text" (keyup)="oneKey($event)">
      <p>{{value}}</p>
      <input #box (keyup)="0">
      <p>{{box.value}}</p>

      <input #box2 (keyup.enter)="onEnter(box2.value)">  
      <p>{{value2}}</p>
      <app-test-child [name]="myHero"
        #timer >
      </app-test-child>

      <button (click)="timer.start()">Start</button>
      <button (click)="timer.stop()">Stop</button>
      <div>{{timer.seconds}}</div>

    
    `

})

export class TestComponent {
    title = "wbbb";
    myHero = 'asdgasdg';

    value = '';
    oneKey(event: KeyboardEvent) {
      this.value += (<HTMLInputElement>event.target).value + '|';
    }

    value2 = ''
    onEnter(value: string) {
      this.value2 = value;
    }

    agreed = 0;
    disagreed=0;

    onVoted(agreed: boolean) {
      agreed ? this.agreed++ : this.disagreed++;
    }
    
}